package cn.sdormitory.smartdor.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @author: lx
 * @date: 2024/3/28 14:17
 * @description:
 */
@Data
public class StudentTrajectoryExcel {

    @ExcelProperty("学生编号")
    @ColumnWidth(12)
    private Long studentId;

    @ExcelProperty("学生姓名")
    @ColumnWidth(20)
    private String studentName;

    @ExcelProperty("班级")
    @ColumnWidth(25)
    private String className;

    @ExcelProperty("卡类型")
    @ColumnWidth(30)
    private String studentCategoryName;

    @ExcelProperty("刷脸设备")
    @ColumnWidth(20)
    private String deviceAddr;

    @ExcelProperty("刷脸时间")
    @ColumnWidth(25)
    private String faceTime;

    @ExcelProperty("类型")
    @ColumnWidth(20)
    private String type;

    public void setType(String type) {
        if(StringUtils.isBlank(type)){
            return;
        }
        switch (type){
            case "1":
                this.type = "进入校园";
                break;
            case "2":
                this.type = "离开校园";
                break;
            case "3":
                this.type = "宿舍打卡";
                break;
            case "4":
                this.type = "未对应规则";
                break;
            case "5":
                this.type = "进入校园(请假)";
                break;
            case "6":
                this.type = "离开校园(请假)";
                break;
            case "7":
                this.type = "进入校园(迟到)";
                break;
        }
    }

    @ExcelProperty("来源")
    @ColumnWidth(10)
    private String referer;

}
